﻿using System.Web.Mvc;
using CodeStash.Services;

namespace CodeStash.Controllers
{
    public class ErrorController : Controller
    {

        private ILoggerService loggerService;

        public ErrorController(ILoggerService loggerService)
        {
            this.loggerService = loggerService;
        }

        public ActionResult Index()
        {
            loggerService.Error("Error : A general error has occurred");
            return View();
        }

        public ActionResult Error301()
        {
            loggerService.Error("Error : 301 error, Moved Permanently");
            return View();
        }

        public ActionResult Error302()
        {
            loggerService.Error("Error : 302 error, Moved Temporarily");
            return View();
        }

        public ActionResult Error303()
        {
            loggerService.Error("Error : 303 error, See Other");
            return View();
        }

        public ActionResult Error304()
        {
            loggerService.Error("Error : 304 error, Not Modified. The cached version of the requested file is the same as the file to be sent");
            return View();
        }

        public ActionResult Error305()
        {
            loggerService.Error("Error : 305 error, Use Proxy");
            return View();
        }

        public ActionResult Error400()
        {
            loggerService.Error("Error : 400 error, Bad Request");
            return View();
        }

        public ActionResult Error401()
        {
            loggerService.Error("Error : 401 error, Unauthorized User, failed to provide a valid user name / password required for access to file / directory");
            return View();
        }

        public ActionResult Error402()
        {
            loggerService.Error("Error : 402 error, Payment Required");
            return View();
        }

        public ActionResult Error403()
        {
            loggerService.Error("Error : 403 error, Forbidden");
            return View();
        }

        public ActionResult Error404()
        {
            loggerService.Error("Error : 404 error, Not Found");
            return View();
        }

        public ActionResult Error405()
        {
            loggerService.Error("Error : 405 error, Method Not Allowed");
            return View();
        }

        public ActionResult Error406()
        {
            loggerService.Error("Error : 406 error, Not Acceptable");
            return View();
        }

        public ActionResult Error407()
        {
            loggerService.Error("Error : 407 error, Proxy Authentication Required");
            return View();
        }

        public ActionResult Error408()
        {
            loggerService.Error("Error : 408 error, Request Time-Out");
            return View();
        }

        public ActionResult Error409()
        {
            loggerService.Error("Error : 409 error, Conflict");
            return View();
        }

        public ActionResult Error410()
        {
            loggerService.Error("Error : 410 error, Gone");
            return View();
        }

        public ActionResult Error411()
        {
            loggerService.Error("Error : 411 error, Length Required");
            return View();
        }
        
        public ActionResult Error412()
        {
            loggerService.Error("Error : 412 error, Precondition Failed");
            return View();
        }

        public ActionResult Error413()
        {
            loggerService.Error("Error : 413 error, Request Entity Too Large");
            return View();
        }

        public ActionResult Error414()
        {
            loggerService.Error("Error : 414 error, Request-URL Too Large");
            return View();
        }

        public ActionResult Error415()
        {
            loggerService.Error("Error : 415 error, Unsupported Media Type");
            return View();
        }
    }
}